<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增参数')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-param-add">
		<h4 class="form-header h4">参数信息</h4>
		<div class="nput-group col-sm-12 row"  id="csList">
			<div  class="col-sm-12 row">
				<label class="col-sm-2 control-label  is-required">参数类型：</label>
				<div class="col-sm-3">
					<select class="first form-control m-b" id="paramterId" name="paramterId"></select>
				</div>
			</div>
			<div  class="col-sm-12 row">
				<label class="col-sm-2 control-label">参数小类：</label>
				<div class="col-sm-3">
					<select class="second form-control m-b" id="paramLlId" name="paramLlId"></select>
				</div>
				<div class="col-sm-3">
					<select class="third form-control m-b" id="paramLl2Id" name="paramLl2Id"></select>
				</div>
				<label class="col-sm-2 control-label  is-required">参数值：</label>
				<div class="col-sm-2">
					<input type="number" placeholder="请输入结果" class="form-control" id="paramterValue" name="paramterValue">
				</div>
			</div>
			<div  class="col-sm-12 row">
				<label class="col-sm-2 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea id="bak" name="bak" class="form-control"></textarea>
				</div>
			</div>
		</div>
	</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<th:block th:include="include :: jquery-cxselect-js" />
<script th:inline="javascript">
    var data = [[${data}]];
    $('#csList').cxSelect({
        selects: ['first', 'second', 'third', 'fourth', 'fifth'],
        required: true,
        jsonValue: 'v',
        data: data
    });

    $("#form-param-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }
    function add(){
        var paramterIds= $.form.selectSelects("paramterId");
        var paramLlIds= $.form.selectSelects("paramLlId");
        var paramLl2Ids= $.form.selectSelects("paramLl2Id");
        var paramterValues = $("#paramterValue").val();
        var baks = $("#bak").val();
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx+"sujian/parameterManagement/add",
            data : {
                "paramterValue": paramterValues,
                "bak": baks,
                "paramterLlId": paramLlIds,
                "paramterLl2Id": paramLl2Ids,
                "paramterId": paramterIds
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>
